    

    <section>

      <ul class="breadcrumb">
        <li><a href="<?php echo base_url('index.php/mainController/'); ?>">Home</a> <span class="divider">/</span></li>
        <li class="active">รายชื่อ Reference</li>
      </ul>

      <div class="page-header">
        <h1>รายชื่อ Reference</h1>

      </div>

      <?php echo form_open('referenceController/create',array('class'=>'form-horizontal')); ?>

       <?php
       $err = validation_errors();

       if($err){
        echo '<div class="alert alert-block" > 
          <a class="close" onclick="$(".alert").hide()">×</a>  
          <strong>แจ้งเตือน!</strong> '.$err.'</div>';
       }
       ?>

        <div class="control-group">
          <label class="control-label" for="group">กลุ่ม</label>
          <div class="controls">
            <select name='group'>
              <?php 
              foreach ($allGroup as $value) {
                echo '<option id="'.$value['ref_group'].'" >';
                echo $value['ref_group'];
                echo '</option>';
              } 
              ?>
            </select>
            <span class="help-inline"></span>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="name">ชื่อ</label>
          <div class="controls">
            <input type="text" name="name" placeholder="ชื่อ">
          </div>
        </div>

        <div class="control-group">
          <label class="control-label" for="status">สถานะ</label>
          <div class="controls">
            <select name='status'>
              <option value="A">Active</option>
              <option value="N">Inactive</option>
            </select>
            <span class="help-inline"></span>
          </div>
        </div>

        <div class="control-group">
            <div class="controls">
              <button type="reset" class="btn">ล้างค่า</button>
              <button id="btnCreate" name="btnCreate" type="submit" class="btn btn-primary">สร้าง</button>
            </div>
          </div>
        
      <?php echo form_close(); ?>

      <table class="table table-striped table-condensed">
        <thead>
          <th>กลุ่ม</th>
          <th>ชื่อ</th>
          <th>สถานะ</th>
          <th>ปรับแต่ง</th>
        </thead>
        <tbody>

          <?php  
            foreach ($resultReference as $row) {

              $status = "";
              if ($row['ref_status'] == 'A') {
                $status = 'ทำงาน';
              }else{
                $status = 'ไม่ทำงาน';
              }

              # code...
              echo sprintf('
                <tr>
                  <td>%s</td>
                  <td>%s</td>
                  <td>'.$status.'</td>
                  <td>%s</td>
                </tr>
                ',$row['ref_group'],iconv('TIS-620', 'UTF-8', $row['ref_name']),
                anchor('referenceController/edit/'.$row['ref_id'],'แก้ไข') 
                
              );
            }
          ?>
          

        </tbody>
      </table>
    </section>
